<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/01/04
  Time: 14:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery.js"></script>
</head>
<body>
<h1>添加投诉页面</h1>
<form action="add" method="post">
    <table border="1">
        <tr style="display: none">
            <td><input type="text" name="id"></td>
        </tr>
        <tr>
            <td>投诉状态：</td>
            <td>
                <input type="radio" name="status" checked value="0">信息审核
                <input type="radio" name="status" value="1">厂家受理
            </td>
        </tr>
        <tr>
            <td>投诉问题：</td>
            <td><input type="text" name="problem" id="problem"></td>
        </tr>
        <tr>
            <td>投诉车系：</td>
            <td><input type="text" name="carType" id="carType"></td>
        </tr>
        <tr>
            <td>投诉品牌：</td>
            <td>
                <select name="brandId" id="brandId">
                    <option value="请选择" selected>-请选择-</option>
                    <option value="1">宝马</option>
                    <option value="2">法拉利</option>
                    <option value="3">兰博基尼</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>投诉时间：</td>
            <td><input type="datetime-local" name="complaintsTime" id="complaintsTime"></td>
        </tr>
        <tr>
            <td>
                <input type="submit" value="新增">
                <input type="button" value="返回" onclick="history.back()">
            </td>
        </tr>
    </table>
</form>
<script>
    $("form").submit(res => {
        if ($("#problem").val() === '') {
            alert("投诉问题不能为空！")
            return false;
        }
        if ($("#carType").val() === '') {
            alert("投诉车系不能为空！")
            return false;
        }
        if (isNaN($("#brandId").val())) {
            alert("投诉品牌不能为空！")
            return false;
        }
        if ($("#complaintsTime").val() === '') {
            alert("投诉时间不能为空！")
            return false;
        }
        // var regPrice = /^[1-9]+.*[0-9]*$/
        // if (!regPrice.test($("#price").val())) {
        //     alert("投诉品牌不能为空")
        //     return false;
        // }

        // var regCount = /^[1-9]+$/
        // if (!regCount.test($("#count").val())) {
        //     alert("器材数量必须大于0")
        //     return false;
        // }
    })
</script>
</body>
</html>
